/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 表单组件服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const controlAttrApi = urls.controlAttr

function listControlAttr(param, page, pageSize, success, complete) {
  postRequest(controlAttrApi.listControlAttr + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function addControlAttr(param, success, complete) {
  postRequest(controlAttrApi.addControlAttr, {}, param, success, complete)
}

function updateControlAttr(id, param, success, complete) {
  postRequest(controlAttrApi.updateControlAttr + id, {}, param, success, complete)
}

function getControlAttr(id, success, complete) {
  getRequest(controlAttrApi.getControlAttr + id, {}, success, complete)
}

function removeControlAttr(ids, success, complete) {
  postRequest(controlAttrApi.removeControlAttr, {}, ids, success, complete)
}

function deleteSingleControlAttr(id, success, complete) {
  let ids = []
  ids.push(id)
  removeControlAttr(ids, success, complete)
}

export default {
  listControlAttr,
  addControlAttr,
  updateControlAttr,
  getControlAttr,
  removeControlAttr,
  deleteSingleControlAttr
}
